package com.wcity.manage.dao.mapper;

import com.wcity.manage.dao.dal.BaseMapper;
import com.wcity.manage.dao.model.Role;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.io.Serializable;

/**
 * 后台角色dao接口
 *
 * @author dy
 */
@Repository
public interface RoleMapper extends BaseMapper<Role, Serializable> {

    /**
     * 根据id获取角色
     *
     * @param id
     * @return
     */
    @Select( " SELECT * FROM td_manage_role WHERE `id` = #{id} " )
    Role findById(@Param("id") int id);

    /**
     * 根据角色名称获取角色
     *
     * @param roleName
     * @return
     */
    @Select( " SELECT * FROM td_manage_role WHERE `role_name` = #{roleName} LIMIT 1 " )
    Role findByRoleName(@Param("roleName") String roleName);

}
